package com.baichang.taoshunda.utils;

import java.io.FileWriter;
import java.io.IOException;

/* *
 *类名：AlipayConfig
 *功能：基础配置类
 *详细：设置帐户有关信息及返回路径
 *修改日期：2017-04-05
 *说明：
 *以下代码只是为了方便商户测试而提供的样例代码，商户可以根据自己网站的需要，按照技术文档编写,并非一定要使用该代码。
 *该代码仅供学习和研究支付宝接口使用，只是提供一个参考。
 */

public class AlipayConfig {
	
//↓↓↓↓↓↓↓↓↓↓请在这里配置您的基本信息↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓

	// 应用ID,您的APPID，收款账号既是您的APPID对应支付宝账号
	public static String app_id = "2017092808973915";
	
	// 商户私钥，您的PKCS8格式RSA2私钥
    public static String merchant_private_key = "MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQC/ZpJ8lkwsDk3t0WQjJO+k4qBlZCuFAwyOIlEjOHgpQtDI8XorTvcalpY/Bvty6h7jSZNMRMHP76C/Ew6W0QGXe8wYgwp0x4/ZNZzmIlWLGkIfjhuxMU7iiOwsjptPYRKpIgLdFE8okWZdxif2lhSQhvg/ZXsk0ap38Etla1pvinhNltUo5vlnYQuiHvAIb41KL6AYVgL1knDNLJLJyiUW0QXxopZhydfDvHxXG6qW6GAPlfVzR6HjRRT0HzeLX9h2DW6YeMe+3bFjgiX8DN6syH3VLa8Cck0ZPDPINPJFrMSyKSPgSjoBtKTEC+8iNNHlDrzUMC7YvX4fsGtwo6EvAgMBAAECggEAARPhxUPPX/wgojMoni4KD2KbRpbey9vtiStWS514x7qxlEAP0QibyZGJfQdcCRSaYes7IhXNBY+y1wCTd3Prz1+KEaVDPM8W10E/BeixlJvsPWM+cqv1Zr8gnUucQkEoqr0fSQFhRLg03FhOR0wnB31LDohSvi1UCWLX+dU16CTb78r8Le5LhLQVFX28sS8m3HzeyWTHRYRXn6CuRrstoDmj0bmnCIZdWG+RmGMPoyWT8i98VlOIN6zI0uKB2gSU+28VeDnZwISGtIgcN/zhcCXApcKxFkS1vopD7RYpMX8tDaPiJJ6Sna7RXF8MjQrGZEbLjfnTPm+mQGo76lDU8QKBgQD5qO6smaHwdvC/FT9oqboDJmia7UrfyMiCmx3YjJpzOtJPfQ/aHvtHOZLOU1I/Yf1tBeq7WKAkWa+PCAz34aQpuHucBYI1HkNilr+u/IsYUMYSmtoXpa7q7xpGlP2c8NnoqkPBZa47qzShCdWSsD1OnpZaivkPJCn3Hn8UaqXZ6QKBgQDEQuPXcn7/69v6+05nguSvKNHuFznaH+AIlFx++6gpmecYBe/eIex8jxQmws+lVsNXGraoiyKaiDH37exGPILLLIbKCK5vrvqWN7pQFEBD6WfZ3+bGkO/Gllp99AXhtbHe7vbhFudzaDywWBtbsC4E+VUedKi/yMUAXoOrSBMbVwKBgQDlpSGd/Fd8NDvw2F+SK4UhvqO71ofn3u2pTXufpH2xfqrTWStKrPLgKjJCvVvLV5xgO3AWUkhEB4c4HuSm4pQ5mCuDcYG60JKVTisVj9F2VV5M4Mm5tLp3+eYGhKfgQ599p5hZfelNk4b+lmgw3RIXjkKpGGpOJiq/1/p20j6qeQKBgGihbIyAyvovSQC+F6eRnc9QCNNQ6JPEKJEKX2GHUriTByPEjoOzPDuPn+OmOkNgRRXb9QNX4ePWtiUCX9N2ERi2LUnqZOy/sXKCVT65/ST3e1kpSAQWYu5RW/8IKFaTojdC2LVZm5zoNmqhHjy8aVxXfKyW7xwHshcnTDT1YNJTAoGBALDdzK61QQPHaB0iYG4PMb4BGKbaUcdhyH+gSd+8rXd/HAGFUKQuK9DbM7jJDFTDXwc8ywOptOKbxHOEfeKDxwzZYAgCwkO4LyUQxvcp6rV3ruS6+2gWcva7GMnLhQXm2e15l8lTaXb84lEYVUj3vq1LkIXBdfnQ3SAnPlzC8b28";
	
	// 支付宝公钥,查看地址：https://openhome.alipay.com/platform/keyManage.htm 对应APPID下的支付宝公钥。
//    public static String alipay_public_key = "MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDDI6d306Q8fIfCOaTXyiUeJHkrIvYISRcc73s3vF1ZT7XN8RNPwJxo8pWaJMmvyTn9N4HQ632qJBVHf8sxHi/fEsraprwCtzvzQETrNRwVxLO5jVmRGi60j8Ue1efIlzPXV9je9mkjzOmdssymZkh2QhUrCmZYI/FCEa3/cNMW0QIDAQAB";
      public static String alipay_public_key = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAkLDjAB/cZ/eQYPWQL2ZI4rm+9HzP09QFYSAe5mDnmLnNYuL2xkYc9VMTuvcsvzLP3p/mualCsedQMLlveLAKUOgZEDuu3pVib6d9zGzcH4KxzYvvMw73mEhPzfuD8Uzq+w9kA0uz2eBJnB8y+oBdZM2C2SBhge6fNlistoWwVMObk3XiUYl+EF0mevxpYNQxjKxTBurMbTdJ9XoRG2WbAaLkEo8LBL7AFr7ZCK+y5drhhI2i9chIpLnA25roCKQWU+ZHranZayvuBryzoni4N3Hqad+xeafqAg6cOD+w1oEPzSGS/51L8UriztxXCuDFIlVoaA/PVQnaL2IYORdQEQIDAQAB";
 //   public static String alipay_public_key = "MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDDI6d306Q8fIfCOaTXyiUeJHkrIvYISRcc73s3vF1ZT7XN8RNPwJxo8pWaJMmvyTn9N4HQ632qJBVHf8sxHi/fEsraprwCtzvzQETrNRwVxLO5jVmRGi60j8Ue1efIlzPXV9je9mkjzOmdssymZkh2QhUrCmZYI/FCEa3/cNMW0QIDAQAB";

	// 服务器异步通知页面路径  需http://格式的完整路径，不能加?id=123这类自定义参数，必须外网可以正常访问
	public static String notify_url = "http://www.taoshunda.com/taoshundapc/pay/aliPayNotify";

	// 页面跳转同步通知页面路径 需http://格式的完整路径，不能加?id=123这类自定义参数，必须外网可以正常访问
	public static String return_url = "http://www.taoshunda.com/taoshunda/page/commodity/commodityDetail.html?bussId=";

	// 签名方式
	public static String sign_type = "RSA2";
	
	// 字符编码格式
	public static String charset = "utf-8";
	
	// 支付宝网关
	public static String gatewayUrl = "https://openapi.alipay.com/gateway.do";
	
	// 支付宝网关
	public static String log_path = "/mnt/apache-tomcat-7.0.73/logs/alipay";


//↑↑↑↑↑↑↑↑↑↑请在这里配置您的基本信息↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑

    /** 
     * 写日志，方便测试（看网站需求，也可以改成把记录存入数据库）
     * @param sWord 要写入日志里的文本内容
     */
    public static void logResult(String sWord) {
        FileWriter writer = null;
        try {
            writer = new FileWriter(log_path + "alipay_log_" + System.currentTimeMillis()+".txt");
            writer.write(sWord);
        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            if (writer != null) {
                try {
                    writer.close();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
        }
    }
}

